<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();
?>

<header>
	<hgroup>
		<h1><?php echo $table_info['title']; ?></h1>
		<h2><?php __e('List'); ?></h2>

		<?php if (hasText($table_info['description'])) {
			echo '<p>'.$table_info['description'].'</p>';
		} ?>
	</hgroup>

	<nav>
		<?php
		echo $Html->a(array(
			'text' => __('New'),
			'href' => path(true, true, 'new'),
			'class' => 'button',
			'data-icon' => 'plus'
		));
		?>
	</nav>

	<?php $Templates->render('aux-search.php', array('action_url' => path())); ?>
</header>

<article>
	<?php if ($list['body']): ?>

	<table class="list">
		<thead><?php $Templates->render('aux-list-table-head.php', array('header' => $list['head'])); ?></thead>

		<tbody>
			<?php
			$Templates->render('aux-list-table-body.php', array(
				'rows' => $list['body'],
				'actions_template' => 'aux-list-table-body-actions.php'
			));
			?>
		</tbody>
	</table>

	<div class="actions"><?php
		echo $Html->a(array(
			'text' => __('Select all'),
			'id' => 'option-select-all',
			'class' => 'option',
		));
		echo $Html->a(array(
			'text' => __('Select none'),
			'id' => 'option-select-none',
			'class' => 'option'
		));
		echo $Html->a(array(
			'text' => __('Invert selection'),
			'id' => 'option-invert-selection',
			'class' => 'option'
		));

		echo $Html->a(array(
			'text' => __('Delete'),
			'href' => path(true, true, '|id|', 'edit'),
			'data-icon' => 'trash',
			'data-no-text' => '1',
			'class' => 'button',
			'action' => array(
				'name' => 'delete',
				'confirm' => __('Do you realy want to delete this?'),
			)
		));
		echo $Html->a(array(
			'text' => __('Edit'),
			'href' => path(true, true, '|id|', 'edit'),
			'class' => 'button',
			'data-icon' => 'pencil'
		));
	?></div>

	<?php $Templates->render('aux-pagination.php', array('pagination' => $pagination)); ?>

	<?php else: ?>
	<?php echo ad(__('No results have been found')); ?>
	<?php endif; ?>
</article>